//package com.wsx.springai.controller;
//
//import jakarta.annotation.Resource;
//import org.springframework.ai.chat.client.ChatClient;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import reactor.core.publisher.Flux;
//
///**
// * @description:
// * @create: 2025-07-16-20:53
// * @athor: wsx
// */
//
//@RestController
//@RequestMapping("/chat")
//public class ChatController {
//
//    @Resource
//    private ChatClient chatClient;
//
//    @RequestMapping("/chat")
//    public String chat(String message) {
//        return chatClient.
//                prompt().
//                user(message)
//                .call()
//                .content();
//    }
//
//    // 使用流式传输，需要指定页面的内容类型，否则会乱码
//    @RequestMapping(value = "/chatFlux",produces = "text/html;charset=UTF-8")
//    public Flux<String> chatFlux(String message) {
//        return chatClient.prompt()
//                .user(message)
//                .stream()
//                .content();
//    }
//
//}
